// exports.Common = void 0;
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_MissionConfig = require("./AL_GAME_HUA_MissionConfig");
// var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
// var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var AL_GAME_HUA_Instance = require("./AL_GAME_HUA_Instance");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_AssetsManager = require("./AL_GAME_HUA_AssetsManager");
// var AL_GAME_HUA_AssetsUtils = require("./AL_GAME_HUA_AssetsUtils");
// var AL_GAME_HUA_ServerTime = require("./AL_GAME_HUA_ServerTime");
// var AL_GAME_HUA_PayData = require("./AL_GAME_HUA_PayData");
// var AL_GAME_HUA_PlayerInfo = require("./AL_GAME_HUA_PlayerInfo");
// (function (e) {
//     function t() {
//         return AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.CHALLENGE
//             ? "challenge"
//             : AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.SPECIAL
//             ? "special"
//             : "level";
//     }

//     function n() {
//         return AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.CHALLENGE
//             ? AL_GAME_HUA_Instance.Instance.ChallengeLevel
//             : AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.SPECIAL
//             ? AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_teshu_guanqia()
//             : AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_guanqia();
//     }

//     function P() {
//         return e.secretDebug || !1;
//     }

//     function g() {
//         return AL_GAME_HUA_ServerTime.default.huoquFuwuqiShijian();
//     }
//     e.isSingleBundle = !1;
//     e.jiexi_lujing_xinxi = function (t) {
//         var n = AL_GAME_HUA_AssetsUtils.AssetsUtils.huoqu_teding_ziyuan_lujing_xinxi(t);
//         var o = n.url;
//         var i = n.bundle;
//         var r = n.type;
//         return e.isSingleBundle
//             ? {
//                   bundle: AL_GAME_HUA_Define.Define.GAME_NAME,
//                   url: "bundles/" + i + "/" + o,
//                   type: r
//               }
//             : {
//                   bundle: i == cc.resources.name ? AL_GAME_HUA_Define.Define.GAME_NAME : i,
//                   url: o,
//                   type: r
//               };
//     };
//     e.bofang_yinxiao = function (t, n) {
//         return __awaiter(this, void 0, void 0, function () {
//             var o;
//             var r;
//             return __generator(this, function () {
//                 o = "audio/" + t;
//                 r = AL_GAME_HUA_Define.Define.GAME_NAME;
//                 return [
//                     2,
//                     new Promise(function (t) {
//                         var i;
//                         var a;
//                         if (Manager.settingStorage.yinxiao_kaiguan_zhuangtai) {
//                             ((i = o),
//                             (a = r),
//                             e.loadRes({
//                                 url: i,
//                                 bundle: a,
//                                 type: cc.AudioClip
//                             }))
//                                 .then(function (e) {
//                                     if (e) {
//                                         var i = cc.audioEngine.play(e, !1, 1);
//                                         if (n && cc.isValid(n)) {
//                                             n.addAutoReleaseAssets(e);
//                                         }
//                                         t({
//                                             url: o,
//                                             id: i,
//                                             success: !0,
//                                             clip: e
//                                         });
//                                     } else {
//                                         t({
//                                             url: o,
//                                             success: !1
//                                         });
//                                     }
//                                 })
//                                 .catch(function () {
//                                     t({
//                                         url: o,
//                                         success: !1
//                                     });
//                                 });
//                         }
//                     })
//                 ];
//             });
//         });
//     };
//     e.playMusic = function (e) {
//         return AL_APP_SDK_MANAGER.playMusic("audio/" + e, AL_GAME_HUA_Define.Define.GAME_NAME, {
//             volume: 1
//         });
//     };
//     e.huoqu_guanqia_moshi_zifuchuan = t;
//     e.huoqu_dangqian_guanqia_moshi_dengji = n;
//     e.youxi_kaishi = function (e) {
//         e = null != e ? e : n();
//         var o = t();
//         ailin_sdk_manager.gameBeginLevel(e, o);
//     };
//     e.youxi_shibai = function (e) {
//         e = null != e ? e : n();
//         var o = t();
//         ailin_sdk_manager.gameFailLevel(e, o);
//     };
//     e.youxi_shengli = function (e) {
//         e = null != e ? e : n();
//         var o = t();
//         ailin_sdk_manager.gameFinishLevel(e, o);
//     };
//     e.xianshi_xiafang_guanggao = function () {
//         console.log("#######xianshi_xiafang_guanggao");
//         if (
//             !AL_GAME_HUA_PayData.PayData.getInstance().huoqu_shifou_yichu_guanggao() &&
//             "tt" != ailin_sdk_manager.getSysPlatformName()
//         ) {
//             if (AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().huoqu_shifou_wei_xin_yonghu()) {
//                 if (AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad) {
//                     var e = 36e5 * AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad_duration;
//                     var t = g();
//                     console.log(t, AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().newPlayerTimeCore);
//                     t - AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().newPlayerTimeCore > e
//                         ? console.log("#######新用户超过24小时")
//                         : "wx" == ailin_sdk_manager.getSysPlatformName()
//                         ? ailin_sdk_manager.xianshiBannerGuanggaoDibu({
//                               scale: 0.8
//                           })
//                         : ailin_sdk_manager.xianshiBannerGuanggaoDibu();
//                 } else {
//                     console.log("#######新用户广告未开启");
//                 }
//             } else {
//                 console.log("#######不是新用户");
//             }
//         }
//     };
//     e.shifou_changping_shouji = function () {
//         return cc.winSize.height / cc.winSize.width > 2;
//     };
//     e.xianshiChapingGuanggaoZhangting = function (e) {
//         if (!AL_GAME_HUA_PayData.PayData.getInstance().huoqu_shifou_yichu_guanggao()) {
//             if (AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().huoqu_shifou_wei_xin_yonghu()) {
//                 if (AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad) {
//                     var t = 36e5 * AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad_duration;
//                     g() - AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().newPlayerTimeCore > t
//                         ? console.log("#######spotPause新用户超过24小时")
//                         : (ailin_sdk_manager.shezhiJiliSpotGuanggaoHuidiao &&
//                               ailin_sdk_manager.shezhiJiliSpotGuanggaoHuidiao(function (t) {
//                                   if (t) {
//                                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
//                                       );
//                                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
//                                       );
//                                       if (e) {
//                                           e();
//                                       }
//                                   }
//                                   ailin_sdk_manager.yichuJiliSpotGuanggaoHuidiao();
//                               }),
//                           ailin_sdk_manager.xianshiChapingGuanggaoZhangting());
//                 } else {
//                     console.log("#######新用户广告未开启");
//                 }
//             } else {
//                 console.log("#######不是新用户");
//             }
//         }
//     };
//     e.xianshiChapingGuanggaoWanchengshi = function (e) {
//         if (
//             !AL_GAME_HUA_PayData.PayData.getInstance().huoqu_shifou_yichu_guanggao() &&
//             AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().huoqu_shifou_wei_xin_yonghu()
//         ) {
//             if (AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad) {
//                 var t = 36e5 * AL_GAME_HUA_GameConst.GameConst.getInstance().new_user_ad_duration;
//                 g() - AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().newPlayerTimeCore > t
//                     ? console.log("#######spotFinish新用户超过24小时")
//                     : (ailin_sdk_manager.shezhiJiliSpotGuanggaoHuidiao &&
//                           ailin_sdk_manager.shezhiJiliSpotGuanggaoHuidiao(function (t) {
//                               if (t) {
//                                   AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                                       AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
//                                   );
//                                   AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                                       AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
//                                   );
//                                   if (e) {
//                                       e();
//                                   }
//                               }
//                               ailin_sdk_manager.yichuJiliSpotGuanggaoHuidiao();
//                           }),
//                       ailin_sdk_manager.xianshiChapingGuanggaoWanchengshi());
//             } else {
//                 console.log("#######新用户广告未开启");
//             }
//         }
//     };
//     e.showVideo = function (t) {
//         var n;
//         return P()
//             ? (e.delay().then(function () {
//                   if (t.success) {
//                       t.success({
//                           type: 2
//                       });
//                   }
//                   user_default.set_data_for_key(
//                       "shareOrVideoCountDaily",
//                       user_default.get_int_for_key("shareOrVideoCountDaily", 0) + 1
//                   );
//                   cc.game.emit("shareOrVideoSuccess");
//                   if (t.completed) {
//                       t.completed();
//                   }
//                   AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                       AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
//                   );
//                   AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                       AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
//                   );
//               }),
//               2)
//             : "wx" != ailin_sdk_manager.getSysPlatformName() || t.justVideo
//             ? (AL_APP_SDK_MANAGER.sdkHelper.handle_fenxiang_huo_shipin_huidiao({
//                   success: function () {
//                       if (t.success) {
//                           t.success({
//                               type: 2
//                           });
//                       }
//                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
//                       );
//                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
//                       );
//                       if (t.completed) {
//                           t.completed();
//                       }
//                   },
//                   fail: function () {
//                       t.fail
//                           ? t.fail()
//                           : AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                                 str: "视频未完播"
//                             });
//                       if (t.completed) {
//                           t.completed();
//                       }
//                   },
//                   notExistCall: function () {
//                       t.fail
//                           ? t.fail()
//                           : AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                                 str: "暂无视频"
//                             });
//                       if (t.completed) {
//                           t.completed();
//                       }
//                   }
//               }),
//               2)
//             : ailin_sdk_manager.zhixingFenxiangHuoShipinLuoji({
//                   location:
//                       null !== (n = t.location) && void 0 !== n ? n : AL_GAME_HUA_Define.Define.SHARE_LOCATION.REWARD,
//                   success: function (e) {
//                       if (t.success) {
//                           t.success(e);
//                       }
//                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
//                       );
//                       AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                           AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
//                       );
//                   },
//                   fail: t.fail,
//                   complete: t.completed
//               });
//     };
//     e.share = function (e) {
//         ailin_sdk_manager.fenxiangDao({
//             location: e.location,
//             isInvite: e.type,
//             complete: function () {
//                 if (e.success) {
//                     e.success();
//                 }
//                 AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                     AL_GAME_HUA_MissionConfig.MissionType.SHARE
//                 );
//             },
//             fail: e.fail
//         });
//     };
//     e.shezhi_anniu_yinyue = function (e, t) {
//         cc.Button.prototype._onTouchBegan = function (n) {
//             var o;
//             if (this.interactable && this.enabledInHierarchy) {
//                 this._pressed = !0;
//                 var i = null === (o = null == this ? void 0 : this.node) || void 0 === o ? void 0 : o.name;
//                 if (i) {
//                     if (i.indexOf("$") >= 0) {
//                         var r = i.substring(i.indexOf("$") + 1);
//                         if (r) {
//                             AL_APP_SDK_MANAGER.bofang_yinxiao(r, e);
//                         }
//                     } else {
//                         if (!(i.indexOf("!") >= 0)) {
//                             AL_APP_SDK_MANAGER.bofang_yinxiao(t, e);
//                         }
//                     }
//                 } else {
//                     AL_APP_SDK_MANAGER.bofang_yinxiao(t, e);
//                 }
//                 this._updateState();
//                 n.stopPropagation();
//             }
//         };
//     };
//     e.geshihua_shijian = function (e, t) {
//         if (void 0 === t) {
//             t = !1;
//         }
//         var n = e / 1e3;
//         var o = 0;
//         var i = 0;
//         if (n > 60) {
//             o = n / 60;
//             n %= 60;
//             if (o > 60 && t) {
//                 i = o / 60;
//                 o %= 60;
//             }
//         }
//         var r = "";
//         if (t) {
//             r += AL_APP_SDK_MANAGER.utils.padding(Math.floor(i)) + ":";
//         }
//         return r + (AL_APP_SDK_MANAGER.utils.padding(Math.floor(o)) + ":") + AL_APP_SDK_MANAGER.utils.padding(Math.floor(n));
//     };
//     e.geshihua_riqi = function (e) {
//         var t = new Date(e);
//         var n = t.getFullYear();
//         var o = t.getMonth() + 1;
//         var i = t.getDate();
//         return n + "/" + AL_APP_SDK_MANAGER.utils.padding(o, 2) + "/" + AL_APP_SDK_MANAGER.utils.padding(i, 2);
//     };
//     e.huoqu_weight_suoyin = function (e) {
//         var t = 0;
//         e.forEach(function (e) {
//             t += e;
//         });
//         var n = Math.random() * t;
//         var o = 0;
//         for (var i = 0; i < e.length; i++) {
//             if (n < (o += e[i])) {
//                 return i;
//             }
//         }
//         return e.length - 1;
//     };
//     e.secretDebug = !1;
//     e.isDebug = P;
//     e.shifou_tiaoshi_zhifu = function () {
//         return P();
//     };
//     e.shifou_keyi_kaiqi_tiaozhan_guanqia = function () {
//         return (
//             AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.NORMAL &&
//             AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_guanqia() ==
//                 AL_GAME_HUA_GameConst.GameConst.getInstance().lv2hard_level &&
//             AL_GAME_HUA_GameConst.GameConst.getInstance().lv2hard_enabled
//         );
//     };
//     e.vibrate = function (e) {
//         if (void 0 === e) {
//             e = !1;
//         }
//         if (AL_APP_SDK_MANAGER.settingStorage.zhendong_zhuangtai) {
//             "wx" == ailin_sdk_manager.getSysPlatformName()
//                 ? window.wx &&
//                   window.wx.vibrateShort({
//                       type: e ? "heavy" : "light"
//                   })
//                 : AL_APP_SDK_MANAGER.vibrate(e);
//         }
//     };
//     e.huoquDengluShuju = function () {
//         if ("native" == ailin_sdk_manager.getSysPlatformName()) {
//             var e = jsb.reflection.callStaticMethod("com/util/JniUtil", "huoquDengluShuju", "()Ljava/lang/String;");
//             if (e && "string" == typeof e) {
//                 try {
//                     if ((e = JSON.parse(e)).data && 200 == e.code) {
//                         return e.data;
//                     }
//                 } catch (e) {
//                     return {};
//                 }
//             }
//         }
//         return {};
//     };
//     e.delay = function (e, t) {
//         if (void 0 === e) {
//             e = 0;
//         }
//         return __awaiter(this, void 0, void 0, function () {
//             return __generator(this, function () {
//                 return [
//                     2,
//                     new Promise(function (n) {
//                         t
//                             ? t.scheduleOnce(function () {
//                                   n();
//                               }, e)
//                             : cc.Canvas.instance.scheduleOnce(function () {
//                                   n();
//                               }, e);
//                     })
//                 ];
//             });
//         });
//     };
//     e.uniform_scale = function (e, t, n) {
//         if (e && e.spriteFrame) {
//             var o = e.spriteFrame.getOriginalSize();
//             var i = o.width;
//             var r = o.height;
//             var a = i / t;
//             var s = r / n;
//             a >= s
//                 ? ((e.node.width = i / a), (e.node.height = r / a))
//                 : ((e.node.width = i / s), (e.node.height = r / s));
//         }
//     };
//     e.loadRes = function (e) {
//         var t = AL_GAME_HUA_AssetsUtils.AssetsUtils.huoqu_teding_ziyuan_lujing_xinxi(e);
//         var n = t.url;
//         var o = t.bundle;
//         e.bundle || o != cc.resources.name
//             ? "#0" == o
//                 ? (o = AL_GAME_HUA_Define.Define.GAME_NAME)
//                 : o.indexOf("#") >= 0 && (o = AL_GAME_HUA_Define.Define.GAME_NAME + "_" + o.replace("#", ""))
//             : (o = AL_GAME_HUA_Define.Define.GAME_NAME);
//         e.url = n;
//         e.bundle = o;
//         return AL_GAME_HUA_AssetsManager.AssetsManager.Instance.loadRes(e);
//     };
//     e.huoqu_dangqian_shijian = g;
//     e.shijian_to_riqi = function (e) {
//         var t = new Date(e);
//         return t.getFullYear() + "-" + (t.getMonth() + 1) + "-" + t.getDate();
//     };
//     e.shijian_to_riqi_mingxi = function (e) {
//         var t = new Date(e);
//         return (
//             t.getFullYear() +
//             "-" +
//             (t.getMonth() + 1) +
//             "-" +
//             t.getDate() +
//             " " +
//             t.getHours() +
//             ":" +
//             t.getMinutes() +
//             ":" +
//             t.getSeconds()
//         );
//     };
//     e.getSetting = function (e) {
//         return "undefined" == typeof wx
//             ? Promise.reject()
//             : new Promise(function (t, n) {
//                   var o = wx.getSetting;
//                   o
//                       ? o({
//                             success: function (o) {
//                                 o.authSetting
//                                     ? e in o.authSetting == 0
//                                         ? t({
//                                               result: !1,
//                                               type: 0
//                                           })
//                                         : 0 == o.authSetting[e]
//                                         ? t({
//                                               result: !1,
//                                               type: 1
//                                           })
//                                         : t({
//                                               result: !0
//                                           })
//                                     : n();
//                             },
//                             fail: function (e) {
//                                 console.error("getSetting fail:", e);
//                                 n(e);
//                             }
//                         })
//                       : n();
//               });
//     };
//     e.authorize = function (e) {
//         var t = this;
//         return "undefined" == typeof wx
//             ? Promise.reject()
//             : new Promise(function (n, o) {
//                   wx.requirePrivacyAuthorize({
//                       success: function () {
//                           t.getSetting(e)
//                               .then(function (t) {
//                                   if (0 == t.result) {
//                                       if (0 == t.type) {
//                                           var i = wx.authorize;
//                                           i
//                                               ? i({
//                                                     scope: e,
//                                                     success: function () {
//                                                         n();
//                                                     },
//                                                     fail: function (e) {
//                                                         o(e);
//                                                     }
//                                                 })
//                                               : n();
//                                       } else {
//                                           if (1 == t.type) {
//                                               var r = wx.openSetting;
//                                               r
//                                                   ? r({
//                                                         success: function (t) {
//                                                             t.authSetting
//                                                                 ? e in t.authSetting == 0 || 0 == t.authSetting[e]
//                                                                     ? o()
//                                                                     : n()
//                                                                 : o();
//                                                         },
//                                                         fail: function (e) {
//                                                             console.error("openSetting fail:", e);
//                                                             o(e);
//                                                         }
//                                                     })
//                                                   : o();
//                                           }
//                                       }
//                                   } else {
//                                       n();
//                                   }
//                               })
//                               .catch(function () {
//                                   o();
//                               });
//                       },
//                       fail: o
//                   });
//               });
//     };
//     e.shengcheng_suiji_zifuchuan = function (e) {
//         var t = "";
//         var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
//         for (var o = 0; o < e; o++) {
//             t += n.charAt(Math.floor(Math.random() * n.length));
//         }
//         return t;
//     };
// })(exports.Common || (exports.Common = {}));
// window.jiema_cunchu_shuju = function (e) {
//     for (var t in e)
//         if ("Key_Gold" != t) {
//             var n = e[t];
//             if ("string" == typeof n) {
//                 e[t] = window.AL_Framework_Bit_Encrypt.decode(n, "VuxiAKihQ0VR9WRe");
//             }
//             e[t] = JSON.parse(e[t]);
//         }
//     console.log(e);
// };



// 导入所需模块
var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
var AL_GAME_HUA_MissionConfig = require("./AL_GAME_HUA_MissionConfig");
var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
var AL_GAME_HUA_Instance = require("./AL_GAME_HUA_Instance");
var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
var AL_GAME_HUA_AssetsManager = require("./AL_GAME_HUA_AssetsManager");
var AL_GAME_HUA_AssetsUtils = require("./AL_GAME_HUA_AssetsUtils");
var AL_GAME_HUA_ServerTime = require("./AL_GAME_HUA_ServerTime");
// var AL_GAME_HUA_PayData = require("./AL_GAME_HUA_PayData");
// var AL_GAME_HUA_PlayerInfo = require("./AL_GAME_HUA_PlayerInfo");

/** 
 * @namespace
 * 公共模块
 */
(function (commonModule) {

    /**
     * 获取当前关卡类型的字符串
     * @returns {string} 返回关卡类型：'challenge', 'special' 或 'level'
     */
    function huoqu_guanqia_moshi_zifuchuan() {
        return AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.CHALLENGE
            ? "challenge"
            : AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.SPECIAL
            ? "special"
            : "level";
    }

    /**
     * 获取当前关卡等级
     * @returns {number} 返回当前关卡等级
     */
    function huoqu_dangqian_guanqia_moshi_dengji() {
        return AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.CHALLENGE
            ? AL_GAME_HUA_Instance.Instance.ChallengeLevel
            : AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.SPECIAL
            ? AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_teshu_guanqia()
            : AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_guanqia();
    }

    /**
     * 判断是否为秘密调试模式
     * @returns {boolean} 返回秘密调试模式状态
     */
    function shifou_mimi_tiaoshi_moshi() {
        return commonModule.secretDebug || false;
    }

    /**
     * 获取服务器时间
     * @returns {Date} 返回服务器时间
     */
    function huoquFuwuqiShijian() {
        return AL_GAME_HUA_ServerTime.default.huoquFuwuqiShijian();
    }

    commonModule.secretDebug = false;
    commonModule.isDebug = shifou_mimi_tiaoshi_moshi;

    commonModule.isSingleBundle = false;

    /**
     * 解析路径信息
     * @param {string} path 路径字符串
     * @returns {Object} 返回解析后的路径信息对象
     */
    commonModule.jiexi_lujing_xinxi = function (path) {
        var pathInfo = AL_GAME_HUA_AssetsUtils.AssetsUtils.huoqu_teding_ziyuan_lujing_xinxi(path);
        var assetUrl = pathInfo.url;
        var assetBundle = pathInfo.bundle;
        var assetType = pathInfo.type;
        return commonModule.isSingleBundle
            ? {
                  bundle: AL_GAME_HUA_Define.Define.GAME_NAME,
                  url: "bundles/" + assetBundle + "/" + assetUrl,
                  type: assetType
              }
            : {
                  bundle: assetBundle == cc.resources.name ? AL_GAME_HUA_Define.Define.GAME_NAME : assetBundle,
                  url: assetUrl,
                  type: assetType
              };
    };

    /**
     * 异步播放音效
     * @param {string} audioName 音效名称
     * @param {Object} [callback] 回调对象
     * @returns {Promise} 返回播放结果的Promise对象
     */
    commonModule.bofang_yinxiao = function (audioName, callback) {
        return __awaiter(this, void 0, void 0, function () {
            var audioPath, gameName;
            return __generator(this, function () {
                audioPath = "audio/" + audioName;
                gameName = AL_GAME_HUA_Define.Define.GAME_NAME;
                return [
                    2,
                    new Promise(function (resolve) {
                        if (Manager.settingStorage.yinxiao_kaiguan_zhuangtai) {
                            commonModule.loadRes({
                                url: audioPath,
                                bundle: gameName,
                                type: cc.AudioClip
                            })
                                .then(function (audioClip) {
                                    if (audioClip) {
                                        var audioId = cc.audioEngine.play(audioClip, false, 1);
                                        if (callback && cc.isValid(callback)) {
                                            callback.addAutoReleaseAssets(audioClip);
                                        }
                                        resolve({
                                            url: audioPath,
                                            id: audioId,
                                            success: true,
                                            clip: audioClip
                                        });
                                    } else {
                                        resolve({
                                            url: audioPath,
                                            success: false
                                        });
                                    }
                                })
                                .catch(function () {
                                    resolve({
                                        url: audioPath,
                                        success: false
                                    });
                                });
                        }
                    })
                ];
            });
        });
    };

    /**
     * 播放游戏背景音乐
     * @param {string} musicName 音乐名称
     * @returns {Promise} 返回播放结果的Promise对象
     */
    commonModule.playMusic = function (musicName) {
        return AL_APP_SDK_MANAGER.playMusic("audio/" + musicName, AL_GAME_HUA_Define.Define.GAME_NAME, {
            volume: 1
        });
    };

    // 定义以下函数
    commonModule.huoqu_guanqia_moshi_zifuchuan = huoqu_guanqia_moshi_zifuchuan;
    commonModule.huoqu_dangqian_guanqia_moshi_dengji = huoqu_dangqian_guanqia_moshi_dengji;

    // 游戏过程相关函数
    commonModule.youxi_kaishi = function (level) {
        level = level != null ? level : huoqu_dangqian_guanqia_moshi_dengji();
        ailin_sdk_manager.gameBeginLevel(level, huoqu_guanqia_moshi_zifuchuan());
    };

    commonModule.youxi_shibai = function (level) {
        level = level != null ? level : huoqu_dangqian_guanqia_moshi_dengji();
        //console.log("我是谁55");
        ailin_sdk_manager.gameFailLevel(level, huoqu_guanqia_moshi_zifuchuan());
        //console.log("我是谁66");
    };

    commonModule.youxi_shengli = function (level) {
        level = level != null ? level : huoqu_dangqian_guanqia_moshi_dengji();
        ailin_sdk_manager.gameFinishLevel(level, huoqu_guanqia_moshi_zifuchuan());
    };

    // 显示广告相关函数
    commonModule.xianshi_xiafang_guanggao = function () {
    };

    // 定义其他函数及属性
    commonModule.shifou_changping_shouji = function () {
        return cc.winSize.height / cc.winSize.width > 2;
    };

    commonModule.xianshiChapingGuanggaoZhangting = function (callback) {
    };

    // 重复代码块和showSpotByPause函数相似，应该考虑合并
    commonModule.xianshiChapingGuanggaoWanchengshi = function (callback) {
    };

    commonModule.showVideo = function (callbacks) {
        var location;
        return shifou_mimi_tiaoshi_moshi()
            ? (commonModule.delay().then(function () {
                  if (callbacks.success) {
                      callbacks.success({
                          type: 2
                      });
                  }
                  user_default.set_data_for_key(
                      "shareOrVideoCountDaily",
                      user_default.get_int_for_key("shareOrVideoCountDaily", 0) + 1
                  );
                  cc.game.emit("shareOrVideoSuccess");
                  if (callbacks.completed) {
                      callbacks.completed();
                  }
                  AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                      AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
                  );
                  AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                      AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
                  );
              }),
              2)
            : "wx" != ailin_sdk_manager.getSysPlatformName() || callbacks.justVideo
            ? (AL_APP_SDK_MANAGER.sdkHelper.handle_fenxiang_huo_shipin_huidiao({
                  success: function () {
                      if (callbacks.success) {
                          callbacks.success({
                              type: 2
                          });
                      }
                      AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                          AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
                      );
                      AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                          AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
                      );
                      if (callbacks.completed) {
                          callbacks.completed();
                      }
                  },
                  fail: function () {
                      callbacks.fail
                          ? callbacks.fail()
                          : AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
                                str: "视频未完播"
                            });
                      if (callbacks.completed) {
                          callbacks.completed();
                      }
                  },
                  notExistCall: function () {
                      callbacks.fail
                          ? callbacks.fail()
                          : AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
                                str: "暂无视频"
                            });
                      if (callbacks.completed) {
                          callbacks.completed();
                      }
                  }
              }),
              2)
            : ailin_sdk_manager.zhixingFenxiangHuoShipinLuoji({
                  location:
                      (location = callbacks.location) !== null && location !== void 0 ? location : AL_GAME_HUA_Define.Define.SHARE_LOCATION.REWARD,
                  success: function (result) {
                      if (callbacks.success) {
                          callbacks.success(result);
                      }
                      AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                          AL_GAME_HUA_MissionConfig.MissionType.VIDEO_DAILY
                      );
                      AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                          AL_GAME_HUA_MissionConfig.MissionType.VIDEO_TOTAL
                      );
                  },
                  fail: callbacks.fail,
                  complete: callbacks.completed
              });
    };

    commonModule.share = function (callbacks) {
        ailin_sdk_manager.fenxiangDao({
            location: callbacks.location,
            isInvite: callbacks.type,
            complete: function () {
                if (callbacks.success) {
                    callbacks.success();
                }
                AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
                    AL_GAME_HUA_MissionConfig.MissionType.SHARE
                );
            },
            fail: callbacks.fail
        });
    };

    commonModule.shezhi_anniu_yinyue = function (target, music) {
        cc.Button.prototype._onTouchBegan = function (event) {
            if (this.interactable && this.enabledInHierarchy) {
                this._pressed = true;
                var buttonName = this.node && this.node.name;
                if (buttonName) {
                    if (buttonName.indexOf("$") >= 0) {
                        var musicID = buttonName.substring(buttonName.indexOf("$") + 1);
                        if (musicID) {
                            AL_APP_SDK_MANAGER.bofang_yinxiao(musicID, target);
                        }
                    } else if (!(buttonName.indexOf("!") >= 0)) {
                        AL_APP_SDK_MANAGER.bofang_yinxiao(music, target);
                    }
                } else {
                    AL_APP_SDK_MANAGER.bofang_yinxiao(music, target);
                }
                this._updateState();
                event.stopPropagation();
            }
        };
    };

    commonModule.geshihua_shijian = function (timeInMillis, showHours = false) {
        var seconds = timeInMillis / 1000;
        var minutes = 0;
        var hours = 0;
        if (seconds > 60) {
            minutes = Math.floor(seconds / 60);
            seconds %= 60;
            if (minutes > 60 && showHours) {
                hours = Math.floor(minutes / 60);
                minutes %= 60;
            }
        }
        var timeStr = "";
        if (showHours) {
            timeStr += `${AL_APP_SDK_MANAGER.utils.padding(Math.floor(hours))}:`;
        }
        return timeStr + `${AL_APP_SDK_MANAGER.utils.padding(Math.floor(minutes))}:` + AL_APP_SDK_MANAGER.utils.padding(Math.floor(seconds));
    };

    commonModule.geshihua_riqi = function (timestamp) {
        var date = new Date(timestamp);
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var day = date.getDate();
        return `${year}/${AL_APP_SDK_MANAGER.utils.padding(month, 2)}/${AL_APP_SDK_MANAGER.utils.padding(day, 2)}`;
    };

    commonModule.huoqu_weight_suoyin = function (weights) {
        var totalWeight = weights.reduce((acc, weight) => acc + weight, 0);
        var randomWeight = Math.random() * totalWeight;
        var accumulatedWeight = 0;
        for (let i = 0; i < weights.length; i++) {
            if (randomWeight < (accumulatedWeight += weights[i])) {
                return i;
            }
        }
        return weights.length - 1;
    };

    commonModule.shifou_tiaoshi_zhifu = function () {
        return shifou_mimi_tiaoshi_moshi();
    };

    commonModule.shifou_keyi_kaiqi_tiaozhan_guanqia = function () {
        return (
            AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.NORMAL &&
            AL_GAME_HUA_GameData.GameData.getInstance().huoqu_yijiesuo_guanqia() ==
                AL_GAME_HUA_GameConst.GameConst.getInstance().lv2hard_level &&
            AL_GAME_HUA_GameConst.GameConst.getInstance().lv2hard_enabled
        );
    };

    commonModule.vibrate = function (isHeavy = false) {
        if (AL_APP_SDK_MANAGER.settingStorage.zhendong_zhuangtai) {
            "wx" == ailin_sdk_manager.getSysPlatformName()
                ? window.wx &&
                  window.wx.vibrateShort({
                      type: isHeavy ? "heavy" : "light"
                  })
                : AL_APP_SDK_MANAGER.vibrate(isHeavy);
        }
    };

    commonModule.huoquDengluShuju = function () {
        if ("native" == ailin_sdk_manager.getSysPlatformName()) {
            var loginData = jsb.reflection.callStaticMethod("com/util/JniUtil", "huoquDengluShuju", "()Ljava/lang/String;");
            if (loginData && typeof loginData === "string") {
                try {
                    loginData = JSON.parse(loginData);
                    if (loginData.data && loginData.code === 200) {
                        return loginData.data;
                    }
                } catch (error) {
                    return {};
                }
            }
        }
        return {};
    };

    commonModule.delay = function (delay = 0, node) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function() {
                return [
                    2,
                    new Promise(function (resolve) {
                        if (node) {
                            node.scheduleOnce(function () {
                                resolve();
                            }, delay);
                        } else {
                            cc.Canvas.instance.scheduleOnce(function () {
                                resolve();
                            }, delay);
                        }
                    })
                ];
            });
        });
    };

    commonModule.uniform_scale = function (sprite, targetWidth, targetHeight) {
        if (sprite && sprite.spriteFrame) {
            var originalSize = sprite.spriteFrame.getOriginalSize();
            var originalWidth = originalSize.width;
            var originalHeight = originalSize.height;
            var scaleX = originalWidth / targetWidth;
            var scaleY = originalHeight / targetHeight;
            if (scaleX >= scaleY) {
                sprite.node.width = originalWidth / scaleX;
                sprite.node.height = originalHeight / scaleX;
            } else {
                sprite.node.width = originalWidth / scaleY;
                sprite.node.height = originalHeight / scaleY;
            }
        }
    };

    commonModule.loadRes = function (resourceInfo) {
        var pathInfo = AL_GAME_HUA_AssetsUtils.AssetsUtils.huoqu_teding_ziyuan_lujing_xinxi(resourceInfo);
        var url = pathInfo.url;
        var bundle = pathInfo.bundle;
        if (!resourceInfo.bundle || bundle !== cc.resources.name) {
            if (bundle === "#0") {
                bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
            } else if (bundle.indexOf("#") >= 0) {
                bundle = AL_GAME_HUA_Define.Define.GAME_NAME + "_" + bundle.replace("#", "");
            }
        } else {
            bundle = AL_GAME_HUA_Define.Define.GAME_NAME;
        }
        resourceInfo.url = url;
        resourceInfo.bundle = bundle;
        return AL_GAME_HUA_AssetsManager.AssetsManager.Instance.loadRes(resourceInfo);
    };

    commonModule.huoqu_dangqian_shijian = huoquFuwuqiShijian;

    commonModule.shijian_to_riqi = function (timestamp) {
        var date = new Date(timestamp);
        return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
    };

    commonModule.shijian_to_riqi_mingxi = function (timestamp) {
        var date = new Date(timestamp);
        return (
            `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ` +
            `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
        );
    };

    commonModule.getSetting = function (permission) {
        if (typeof wx === "undefined") {
            return Promise.reject();
        }
        return new Promise(function (resolve, reject) {
            var getSetting = wx.getSetting;
            if (!getSetting) {
                return reject();
            }

            getSetting({
                success: function (settings) {
                    if (settings.authSetting) {
                        if (!settings.authSetting.hasOwnProperty(permission)) {
                            resolve({ result: false, type: 0 });
                        } else if (settings.authSetting[permission] === false) {
                            resolve({ result: false, type: 1 });
                        } else {
                            resolve({ result: true });
                        }
                    } else {
                        reject();
                    }
                },
                fail: function (error) {
                    console.error("getSetting fail:", error);
                    reject(error);
                }
            });
        });
    };

    commonModule.authorize = function (scope) {
        var common = this;
        if (typeof wx === "undefined") {
            return Promise.reject();
        }
        return new Promise(function (resolve, reject) {
            wx.requirePrivacyAuthorize({
                success: function () {
                    common.getSetting(scope)
                        .then(function (setting) {
                            if (!setting.result) {
                                if (setting.type === 0) {
                                    var authorize = wx.authorize;
                                    if (authorize) {
                                        authorize({
                                            scope: scope,
                                            success: function () {
                                                resolve();
                                            },
                                            fail: function (error) {
                                                reject(error);
                                            }
                                        });
                                    } else {
                                        resolve();
                                    }
                                } else if (setting.type === 1) {
                                    var openSetting = wx.openSetting;
                                    if (openSetting) {
                                        openSetting({
                                            success: function (settings) {
                                                if (
                                                    settings.authSetting &&
                                                    (settings.authSetting[scope] === undefined || !settings.authSetting[scope])
                                                ) {
                                                    reject();
                                                } else {
                                                    resolve();
                                                }
                                            },
                                            fail: function (error) {
                                                console.error("openSetting fail:", error);
                                                reject(error);
                                            }
                                        });
                                    } else {
                                        reject();
                                    }
                                }
                            } else {
                                resolve();
                            }
                        })
                        .catch(function () {
                            reject();
                        });
                },
                fail: reject
            });
        });
    };

    commonModule.shengcheng_suiji_zifuchuan = function (length) {
        var randomString = "";
        var charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for (var i = 0; i < length; i++) {
            randomString += charset.charAt(Math.floor(Math.random() * charset.length));
        }
        return randomString;
    };

})(exports.Common || (exports.Common = {}));

/**
 * 解码存储数据
 * @param {Object} storage 需要解码的存储对象
 */
window.jiema_cunchu_shuju = function (storage) {
    for (var key in storage) {
        if (key !== "Key_Gold") {
            var encodedData = storage[key];
            if (typeof encodedData === "string") {
                storage[key] = window.AL_Framework_Bit_Encrypt.decode(encodedData, "VuxiAKihQ0VR9WRe");
            }
            storage[key] = JSON.parse(storage[key]);
        }
    }
    console.log(storage);
};
